/**
 * 
 */
package com.nwpu.bigdata.dto;

/**
 * 所有前端请求的返回类型，封装json结果，前端采用一致的方式，判断返回的json是否为true 为true拿数据，为false输出错误信息。
 * @author carlin
 * @param <T> 返回结果封装的数据类型
 */
public class BackendResult<T> {
	private boolean success;
	private T data;
	private String error;

	/**
	 * success为true时候，传入数据
	 * 
	 * @param success 返回结果中是否有数据
	 * @param data 返回的数据
	 */
	public BackendResult(boolean success, T data) {
		super();
		this.success = success;
		this.data = data;
	}

	public BackendResult(boolean success, String error) {
		super();
		this.success = success;
		this.error = error;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public String getError() {
		return error;
	}

	public void setError(String error) {
		this.error = error;
	}

}
